myApp.controller('myController', ['$scope', '$http', function ($scope, $http) {
    $scope.logout = function () {
        $http.get(ctx + "/logout").then(function (response) {
            if (response.data.result == 'success') {
                window.location.href = ctx + "/loginPage";
            }
        });
    }
}
]);